<?php

function reequipment_adminapi_deleterelcycles($args)
{
    // Get arguments from argument array
    extract($args);

    // Get datbase setup
    $dbconn =& xarDBGetConn();
    $xartable =& xarDBGetTables();
    $table = $xartable['rel_cycles'];

    // Delete the item
    $query = "DELETE FROM $table";
    
    $where = array();
    $bind = array();
    
    if (!empty($item_id)) {
        $where[] = 'item_id = ?';
        $bind[] = (int)$item_id;
    }
    
    if (!empty($maintenance_id)) {
        $where[] = 'maintenance_id = ?';
        $bind[] = (int)$maintenance_id;
    }    
       
    if (!empty($where)) {
        $query .= ' WHERE ' . implode(' AND ', $where);
    }
    
    $result =& $dbconn->Execute($query,$bind);
    if (!$result) return;
    return true;
}
?>